package com.arges.web.dao;

import org.springframework.stereotype.Repository;

import com.arges.web.domain.pojo.Fun;

/**
 * 患者随访记录dao
 *
 * @author zxj
 */
@Repository
public class FunDao extends GenericDao<Fun, Long>
{

	public Fun getFunByMrn(String mrn)
	{
		String hql = "from Fun p where p.mrn=?";
		return (Fun) getSession().createQuery(hql).setParameter(0, mrn).uniqueResult();
	}

	public void deletePatByIds(Long[] deleteId)
	{
		StringBuffer hql = new StringBuffer();
		hql.append("delete from Fun where id in (");
		for (int i = 0; i < deleteId.length; i++)
		{
			hql.append(deleteId[i] + ",");
		}
		hql.deleteCharAt(hql.length() - 1).append(")");
		getSession().createQuery(hql.toString()).executeUpdate();
	}

}
